import request from '@/config/axios'

export interface ArticleCategoryVO {
  id: number | string // 唯一编号
  parentId: number | string // 父级编号
  name: string // 分类名称
  sort: number // 分类排序
  status: number // 开启状态
}

// 查询文章分类列表
export const getArticleCategoryPage = async (params) => {
  return await request.get({ url: `/cms/article-category/page`, params })
}

// 查询文章分类精简信息列表
export const getSimpleArticleCategoryList = async () => {
  return await request.get({ url: `/cms/article-category/list-all-simple` })
}

// 查询文章分类详情
export const getArticleCategory = async (id: number | string) => {
  return await request.get({ url: `/cms/article-category/get?id=` + id })
}

// 新增文章分类
export const createArticleCategory = async (data: ArticleCategoryVO) => {
  return await request.post({ url: `/cms/article-category/create`, data })
}

// 修改文章分类
export const updateArticleCategory = async (data: ArticleCategoryVO) => {
  return await request.post({ url: `/cms/article-category/update`, data })
}

// 删除文章分类
export const deleteArticleCategory = async (id: number | string) => {
  return await request.get({ url: `/cms/article-category/delete?id=` + id })
}
